package com.lovo.project.test;

import com.lovo.project.dao.UserRoleDAO;
import com.lovo.project.enums.UserRoleCodeEnum;
import com.lovo.project.exception.OurException;
import com.lovo.project.model.RoleDO;
import com.lovo.project.service.UserRoleService;
import com.lovo.project.service.impl.UserRoleServiceImpl;
import com.lovo.project.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @title 测试
 * @author: yuyuan
 * @date: 2020/11/3 16:23
 */

public class test {
    @Test
    public void a(){
        SqlSession sqlSession  = MyBatisUtil.getSqlSession();
        UserRoleDAO dao = sqlSession.getMapper(UserRoleDAO.class);
        System.out.println(dao.selectOtherRoleByUserId(2));

    }
    @Test
    public void b(){
        UserRoleService userRoleService = new UserRoleServiceImpl();
        List<String> list = new ArrayList<>();
        list.add("2");
        list.add("3");
//        userRoleService.deleteAllRoleByUserId(2);
        userRoleService.addRoleByUserIdAndRoleId(2,list);
    }

    public static void main(String[] args) {
        String a = "1604905610000,\n" +
                "        1604909270000,1604905795000,\n" +
                "        1604909275000";
        String[] a1 = a.replaceAll(" ","").split(",");
        for (String string : a1) {
            System.out.println(string.replaceAll(" ","").length());
        }
    }

}
